package com.ruoyi.business.service.impl;

import java.util.List;

import com.ruoyi.business.domain.vo.JtWarehouseVo;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtWarehouseMapper;
import com.ruoyi.business.domain.JtWarehouse;
import com.ruoyi.business.service.IJtWarehouseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 仓库Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-03-29
 */
@Service
public class JtWarehouseServiceImpl implements IJtWarehouseService 
{
    @Autowired
    private JtWarehouseMapper jtWarehouseMapper;

    /**
     * 查询仓库
     * 
     * @param warehouseId 仓库主键
     * @return 仓库
     */
    @Override
    public JtWarehouse selectJtWarehouseByWarehouseId(Long warehouseId)
    {
        return jtWarehouseMapper.selectJtWarehouseByWarehouseId(warehouseId);
    }

    /**
     * 查询仓库列表
     * 
     * @param jtWarehouse 仓库
     * @return 仓库
     */
    @Override
    public List<JtWarehouse> selectJtWarehouseList(JtWarehouse jtWarehouse)
    {
        return jtWarehouseMapper.selectJtWarehouseList(jtWarehouse);
    }

    /**
     * 新增仓库
     * 
     * @param jtWarehouse 仓库
     * @return 结果
     */
    @Override
    public int insertJtWarehouse(JtWarehouse jtWarehouse)
    {
        jtWarehouse.setCreateTime(DateUtils.getNowDate());
        return jtWarehouseMapper.insertJtWarehouse(jtWarehouse);
    }

    /**
     * 修改仓库
     * 
     * @param jtWarehouse 仓库
     * @return 结果
     */
    @Override
    public int updateJtWarehouse(JtWarehouse jtWarehouse)
    {
        jtWarehouse.setUpdateTime(DateUtils.getNowDate());
        return jtWarehouseMapper.updateJtWarehouse(jtWarehouse);
    }

    /**
     * 批量删除仓库
     * 
     * @param warehouseIds 需要删除的仓库主键
     * @return 结果
     */
    @Override
    public int deleteJtWarehouseByWarehouseIds(String warehouseIds)
    {
        return jtWarehouseMapper.deleteJtWarehouseByWarehouseIds(Convert.toStrArray(warehouseIds));
    }

    /**
     * 删除仓库信息
     * 
     * @param warehouseId 仓库主键
     * @return 结果
     */
    @Override
    public int deleteJtWarehouseByWarehouseId(Long warehouseId)
    {
        return jtWarehouseMapper.deleteJtWarehouseByWarehouseId(warehouseId);
    }

    /**
     * 查询仓库信息
     * @param status
     * @return
     */
    @Override
    public List<JtWarehouseVo> selectJtWarehouseByStatus(Integer status){
        return jtWarehouseMapper.selectJtWarehouseByStatus(status);
    }
}
